import request from '@/utils/request'
import Cookies from 'js-cookie'
//获取门店对接人
export function getmddocking(data) {
    return request({
        url: '/User/get_list/-1',
        method: 'post',
        data:data
    })
}

//获取总部对接人
export function getdocking(data) {
    return request({
        url: '/Operations_docking_people/docking_list/-1',
        method: 'post',
        data:data
    })
}

//门店对接人点击保存
export function dockingpreservation(data) {
    return request({
        url: '/store/docking_save',
        method: 'post',
        data:data
    })
}
// 门店信息分页
export function getPage(data) {
    return request({
        url: '/store/get_page',
        method: 'post',
        data: data
    })
}
// 门店信息列表
export function getList(data, page) {
    return request({
        url: '/store/get_list/' + (page ? page : 1),
        method: 'post',
        data: data
    })
}
// 一级品牌
export function fristBrandList(data) {
    return request({
        url: '/General/get_brand_first',
        method: 'post',
        data: {
            category_id: 18
        }
    })
}
// 二级品牌
export function childBrandList(id) {
    return request({
        url: '/General/get_brand_second',
        method: 'post',
        data: {
            category_id: 18,
            org: id
        }
    })
}
// 获取门店
export function getStore(data) {
    return request({
        url: '/General/get_store',
        method: 'post',
        data: data
    })
}
// 区域管理
export function areaDetailList(id) {
    return request({
        url: '/Area/index',
        method: 'post',
        data: {
            sid: id
        }
    })
}
// 区域管理删除
export function areaDel(id) {
    return request({
        url: '/Area/delete',
        method: 'post',
        data: {
            id: id
        }
    })
}
// 区域管理新增
export function areaAdd(data) {
    return request({
        url: '/Area/create',
        method: 'post',
        data: data
    })
}
// 配置微信小程序
export function setProgram(data) {
    return request({
        url: '/Store/support_program',
        method: 'post',
        data: data
    })
}
// 新增或编辑门店信息保存
export function storeSave(data,url) {
    return request({
        url: url,
        method: 'post',
        data: data
    })
}
// 关联礼品列表
export function getHouseList(data) {
    return request({
        url: '/Store/get_store_house',
        method: 'post',
        data: data
    })
}
// 搜索house
export function getHouse(data) {
    return request({
        url: '/House/get_house',
        method: 'post',
        data: data
    })
}
// 删除house  
export function delHouse(data) {
    return request({
        url: '/Store/del_store_house',
        method: 'post',
        data: data
    })
}
// 保存house
export function saveHouse(data) {
    return request({
        url: '/Store/store_house_add',
        method: 'post',
        data: data
    })
}
// 获取下载区域
export function getDownArea(data) {
    return request({
        url: '/Area/index',
        method: 'post',
        data: data
    })
}
// 机台信息下载
export function machineDown(data) {
    window.location.href = `https://${location.host}/smsi/index.php/machine/get_excel?store_id=${data.store_id}&area_id=${data.area_id}&didixueshengka=${Cookies.get('SMS_AdminToken')}`; 
    // return request({
    //     url: `/machine/get_excel?store_id=${data.store_id}&area_id=${data.area_id}`,
    //     method: 'get',
    //     responseType: 'blob',
    //     data:{},
    // })
}
// 二维码信息下载
export function qrcodeDown(data) {
    window.location.href = `https://${location.host}/smsi/index.php/machine/get_qrcode?store_id=${data.store_id}&area_id=${data.area_id}&didixueshengka=${Cookies.get('SMS_AdminToken')}`; 
}
// 删除门店
export function delStore(data) {
    return request({
        url: '/Store/delete',
        method: 'post',
        data:data,
    })
}
export function store_info(data) {
    return request({
        url: '/store/get_one',
        method: 'post',
        data:data,
    })
}

//修改状态的
export function deleteStatus(data){
    return request({
        url: '/store/edit_status',
        method: 'post',
        data:data,
    })
}
// 上传图片
export function upload_store_img(data){
    return request({
        url: '/store/upload_store_img',
        method: 'post',
        data:data,
    })
}